package org.mihalovic.PES.GUI;

import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;



public class ImagePanel extends JPanel {

    private BufferedImage image;

    public ImagePanel(String imagePath) throws IOException {
        //TODO: check if the file exists. If not, draw a general Not Available (red X on white background) image
        image = ImageIO.read(new File(imagePath));
    }

    @Override
    public void paintComponent(Graphics g) {
        g.drawImage(image, 0, 0, null); // see javadoc for more info on the parameters
    }
}
